//
//  CellOfThreePic.m
//  ProjectA_ManualGuest
//
//  Created by dingcong on 16/6/17.
//  Copyright © 2016年 丁聪. All rights reserved.
//

#import "CellOfThreePic.h"
#import "PrefixHeader.pch"
#import "Masonry.h"
#import "UIImageView+WebCache.h"
@implementation CellOfThreePic
- (void)dealloc{
    
    [_imageOfFirst release];
    [_imageOfSecond release];
    [_imageOfThird release];
    [_lableOfLeft release];
    [_lableOfRight release];
    [_model release];
    [super dealloc];
    
    
    
    
    
}




- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        [self creat];
    }
    
    
    return self;
    
    
    
}


- (void)creat{
    self.lableOfLeft = [[UILabel alloc]init];
    
//    self.lableOfLeft.backgroundColor = [UIColor greenColor];
    
    [self.contentView addSubview:self.lableOfLeft];
    
    
    [self.lableOfLeft mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(self.contentView.mas_top).offset(5);
        make.leading.equalTo(self.contentView.mas_leading).offset(8);
        make.height.offset(20);
        make.width.offset(70);

    }];
    
   self.lableOfLeft.text = @"精选专题";
    self.lableOfLeft.font = [UIFont systemFontOfSize:13];
    [self.lableOfLeft release];
    
   self.lableOfRight= [[UILabel alloc]init];
    
//    self.lableOfRight.backgroundColor = [UIColor greenColor];
    
    [self.contentView addSubview:self.lableOfRight];
    
    [self.lableOfRight mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.lableOfLeft.mas_centerY);
        make.leading.equalTo(self.lableOfLeft.mas_trailing).offset(315);
        make.height.offset(14);
//        make.width.offset(60);
        
        
    }];
    self.lableOfRight.textColor = [UIColor grayColor];
    self.lableOfRight.text = @"更多";
    self.lableOfRight.font = [UIFont systemFontOfSize:7];
    [self.lableOfRight release];
    
    self.imageOfFirst = [[UIImageView alloc]init];
    
//    self.imageOfFirst.backgroundColor = [UIColor redColor];
    
    [self.contentView addSubview:self.imageOfFirst];
    
    [self.imageOfFirst mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.lableOfLeft.mas_bottom).offset(8);
        make.leading.equalTo(self.contentView.mas_leading).offset(8);
        make.width.offset((SCREEN_WIDTH - 32) / 3);
        make.height.equalTo(self).multipliedBy(1.0 / 1.3);
    }];
    
    [self.imageOfFirst release];
    
    self.imageOfSecond = [[UIImageView alloc]init];
    
//    self.imageOfSecond.backgroundColor = [UIColor redColor];
    
    [self.contentView addSubview:self.imageOfSecond];
    
    [self.imageOfSecond mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.equalTo(self.imageOfFirst.mas_centerY);
        make.leading.equalTo(self.imageOfFirst.mas_trailing).offset(8);
        make.width.offset((SCREEN_WIDTH - 32) / 3);
        make.height.equalTo(self).multipliedBy(1.0 / 1.3);
    }];
    
    [self.imageOfSecond release];
    
    
    self.imageOfThird = [[UIImageView alloc]init];
    
//    self.imageOfThird.backgroundColor = [UIColor redColor];
    
    [self.contentView addSubview:self.imageOfThird];
    
    [self.imageOfThird mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.equalTo(self.imageOfFirst.mas_centerY);
        make.leading.equalTo(self.imageOfSecond.mas_trailing).offset(8);
        make.width.offset((SCREEN_WIDTH - 32) / 3);
        make.height.equalTo(self).multipliedBy(1.0 / 1.3);
    }];
    
    [self.imageOfThird release];
    
}

- (void)setModel:(ModelOfMaterial *)model{
    for (NSInteger i = 0; i < model.arrOfThird.count; i++)
    {
        if (i == 0)
        {
            NSURL *url = [model.arrOfThird objectAtIndex:i];
            [self.imageOfFirst sd_setImageWithURL:url placeholderImage:nil];
            
        }
        else if (i == 1)
        {
            
            NSURL *url = [model.arrOfThird objectAtIndex:i];
            [self.imageOfSecond sd_setImageWithURL:url placeholderImage:nil];
            
        }
        else if(i == 2)
        {
            NSURL *url = [model.arrOfThird objectAtIndex:i];
            [self.imageOfThird sd_setImageWithURL:url placeholderImage:nil];
            
        }
        
        
        
        
        
        
    }
    
    
    
    
    
    
    
    
}

@end
